Instrumentation is a technique that inserts probes in a running program to collect runtime information. Many situations require an analysis of the runtime behavior of a program. For example, a programmer may need to diagnose why certain transaction types in a server run slowly, while others have acceptable performance. In these situations, we diagnose performance or correctness problems in the program's code that only become apparent when studying the program as it runs. In other scenarios, a separate agent must verify whether certain dynamic conditions hold, such as when an optimizing compiler specializes the code depending on how many times a method in the program is invoked on a given input.
One increasingly common reason why problems can best be addressed by analyzing runtime behavior is the heavy reliance on application frameworks (generic applications that display windows and that support copy and paste and other such functions that can be used to write code). When using these application frameworks, such as IBM WebSphere application server, or the Eclipse integrated development environment, a large component of the program's behavior is data or time-dependent. In addition, its behavior is hidden under layers of code to which either the programmer has no access, or whose semantics are poorly documented. For these reasons, programs that use frameworks tend to exhibit runtime behavior that is difficult to predict by only inspecting the application's code.
To analyze dynamic behavior requires inspecting the running program at certain intervals. Each inspection either verifies, aggregates, or records some aspect of the state of the program's runtime at that point in time. For example, an inspection can count how many times the program invokes certain methods or allocates certain types of objects. Another kind of inspection records the details of such invocations or allocations. By “record” we mean to write information to some stable storage at the time of the inspection. The interval at which this inspecting occurs depends on the analysis task. An important criterion of the instrumented program is the perturbation caused as a result of inserting the desired set of probes. This perturbation takes on a number of forms. First and most generally, the instrumented program may run slower than the original program. Second, objects may be allocated that were not in the original program. Third, the compiler may optimize the program in a substantially different way in the presence of probes. For example, the compiler may inline methods when compiling the original program that it does not when compiling the instrumented program. This difference in optimization not only affects the performance of the instrumented program, but may also result in probe output which is merely an artifact of the perturbed optimizations; e.g. if a tool user desires to record invocations only of non-inlined methods, but the probes block the optimizer from inlining, then the probes will record artifactual information.
Low perturbation is of the utmost importance, because it allows runtime inspection of the state of systems where performance and lack of artifacts is critical. For example, in order to diagnose problems on systems that have already been deployed into the field, the analysis must not cause a noticeable degradation of the service level which would otherwise be provided. If such an analysis of a deployed e-commerce application slows down response time of transactions by 50%, the owner of the system will be unhappy: the tool has severely degraded the level of service provided to the owner's customers. However, there is a more serious issue of polluting the quality of information obtained by the analysis: slowdowns of factors of two or more are even worse, because they may result in failures of otherwise well behaving transactions.
This degree of perturbation depends on the how many probes are inserted, what each probe does, how each is implemented, and how each is treated by the compiler or underlying runtime system. This document considers the combination of factors which lead to a very high perturbation, and presents a technique which, for that common combination factors, yields much lower perturbation.